﻿

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[TargetDPITblUpdate_SP]
	-- Add the parameters for the stored procedure here
	@TargetDPI int,
	@datagridkey int,
    @SPF float,
    @SCoM float,
    @MPF float,
    @MCoM float,
    @LPF float,
    @LCoM float,
    @SYPF float,
    @SYCoM float,
    @EPF float,
    @ECoM float,
    @DPF float,
    @DCoM float,
	@error nvarchar(4000) = null OUTPUT
AS
	SET NOCOUNT ON;
BEGIN
	BEGIN TRY
		BEGIN TRANSACTION
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.

    -- Insert statements for procedure here
	Update TargetDPI_Tbl set TargetDPI = @TargetDPI, SPricefactor=@SPF, SCoM=@SCoM,
MPricefactor=@MPF, MCoM=@MCoM, LPricefactor=@LPF, LCoM=@LCoM, SYPricefactor=@SYPF, SYCoM=@SYCoM, 
EPricefactor=@EPF, ECoM=@ECoM, DPricefactor=@DPF, DCoM=@DCoM
    where TargetDPIID = @DataGridKey
		COMMIT TRANSACTION
	END TRY
	
	BEGIN CATCH
		IF @@ERROR <> 0
		ROLLBACK TRANSACTION
		SET @error=ERROR_MESSAGE()
		
	END CATCH
END